//============================================================================
// Name        : GSP295_Wk4_HashTable
// Author      : Ronald Ram
// Version     :
// Copyright   : GSP295 Wk4 Program - Hash Tables
// Description : Hash Table Implemented as Array in C++
//============================================================================



#ifndef HASH_TABLE_H_
#define HASH_TABLE_H_

//#pragma once

#include <iostream>
#include <string>
using namespace std;


namespace GSP295_Wk4
{
	const int hashSize = 127;
	enum ActionType { INSERT=0, DELETE, FIND };
	enum ResultType { SUCCESS=0, COLLISION, FAILED };

	struct Result
	{
		ResultType resultType;
		int index;
	};

	class HashTable
	{
	private:
		string *items;
		int length, countFillCells;

		void Init();					//C004: Init Method

	public:
		HashTable();					//C001: DEFAULT CONSTRUCTOR
		HashTable(int size);			//C002: OVERLOADED CONSTRUCTOR
		virtual ~HashTable();			//C003: DESTRUCTOR

		Result Insert(string input);	//Insert a string into array
		Result Delete(string input);	//Delete an element in the array
		Result Find(string input);		//Find a string in the array
		Result HashFunction(string input , ActionType action); //Hash a key, based on input string

		bool isEmpty() const;			//Check if Array isEmpty
		void Clear();					//Clear all elements in array
		void Print();					//Print all contents of array
	};//class
}//namespace

#endif /*HASH_TABLE_H_*/